package models.security;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Table;

import framework.base.BaseModel;
import play.data.validation.Match;
import play.data.validation.MaxSize;
import play.data.validation.Required;
import play.data.validation.Unique;

@Entity
@Table(name="T_IPTABLE")
public class IPTable extends BaseModel {
    
    //名称
    @Required(message="名称不能为空")
    @MaxSize(value=16,message="名称不能超过16个字符")
    public String name;
    //IP地址
    @Required(message="IP不能为空")
    @Unique(message="IP已存在")
    @Match(value="([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}",message="IP地址不合法")
    public String ip;
    
    public IPTable(){
        this.createdAt = new Date();
        this.updatedAt = new Date();
        this.status = USE_STATUS;
    }
    
    
    
    
    
    
    
}
